#### Start of system configuration section. ####

srcdir =	@srcdir@
VPATH =		@srcdir@

# Common prefix for machine-independent installed files.
prefix =	@prefix@

# Common prefix for machine-dependent installed files.
exec_prefix =	@exec_prefix@

bindir =	$(exec_prefix)/bin
libdir =	$(exec_prefix)/Sys/libs

INSTALL =	@INSTALL@
INSTALL_DATA =	@INSTALL_DATA@

CC =		@CC@

CFLAGS =	@CFLAGS@
LDFLAGS =	@LDFLAGS@

RANLIB =	@RANLIB@
AR =		ar

#### End system configuration section ####

FLAVOR_CFLAGS =	-m$(CPU) -m$(FPU)
OTHER_CFLAGS =	-fomit-frame-pointer
ALL_CFLAGS =	$(CFLAGS) $(FLAVOR_CFLAGS) $(OTHER_CFLAGS) -ffixed-a4 $(INCS)

INCS =		-I$(srcdir) -I$(srcdir)/../library -I$(srcdir)/../include
LIB =		libstdlib.a

.s.o:
		cp $< x.c
		$(CC) $(ALL_CFLAGS) -traditional -E x.c -o x.s
		$(CC) $(ALL_CFLAGS) -c x.s -o $@
		rm -f x.c x.s

.c.o:
		$(CC) $(ALL_CFLAGS) -c $< -o $@

SRC =		abort.c abs.s atexit.c atof.c atoi.c atol.c bsearch.c \
		calloc.c div.c exec.c execve.c getenv.c heapsort.c \
		labs.c ldiv.c multibyte.c putenv.c qsort.c radixsort.c \
		rand.c setenv.c ssystem.c strtol.c strtoul.c system.c

OBJ =		abort.o abs.o atexit.o atof.o atoi.o atol.o bsearch.o \
		calloc.o div.o exec.o execve.o getenv.o heapsort.o \
		labs.o ldiv.o multibyte.o putenv.o qsort.o radixsort.o \
		rand.o setenv.o ssystem.o strtol.o strtoul.o system.o

$(LIB):		$(OBJ)
		rm -f $@
		$(AR) rv $@ $(OBJ)
		$(RANLIB) $@

clean:
		rm -f *!

clobber:	clean
		rm -f $(OBJ) $(LIB)
